<#include "../common/_header.htm">
<div id="hidebox" >
    <div class="box-body">
		<table id="dg"></table>
	</div>
</div>
<script>
	window.onload = firstTable;
	function firstTable(){
		/** 回去传值 **/
		var dialog = top.dialog.get(window);
		var dealFlowUuid = dialog.data.dealFlowUuid; // 获取对话框传递过来的数据
		var caseManagerId = dialog.data.caseManagerId; // 获取对话框传递过来的数据
		if (!caseManagerId) {
			toastr.error("案件id为空");
			return;
		}
        $('#dg').datagrid({
            url: '${ctx}/phone/record/phoneRecordDetail',
            method: 'post',
            iconCls: 'icon-save',
            queryParams:{//每次请求的参数
                uuid : dealFlowUuid,
                casemanageId : caseManagerId
            },
            pageList:[10,20,40,50,100],//每页记录数选择范围设置
            pageNumber:1,//当前页号,
            pageSize:20,//每页显示记录数
            loadMsg:"正在加载，请稍后",//加载数据时的提示信息
            emptyMsg:"暂无信息",//加载数据为空时的信息
            height:($(window).height())-60,
            rownumbers:true,//序号
            fitColumns: true,//使表格自适应页面宽度
            pagination: true,//是否分页
            singleSelect: true,
            columns:[[ //每一列的具体设置。
                {field:'SERVICE_NUMBER',title:'服务号码'},
                {field:'SERVICE_USER_INFORMATION',title:'服务号码用户信息'},
                {field:'SERVICE_LOCATION',title:'服务号码归属地'},
                {field:'BUSINESS_TYPE',title:'业务类型'},
                {field:'PARTY_NUMBER',title:'对方号码'},
                {field:'PARTY_USER_INFORMATION',title:'对方号码用户信息'},
                {field:'PARTY_LOCATION',title:'对方号码归属地'},
                {field:'CALL_TYPE',title:'呼叫类型',
                    formatter: function(value,row,index){ //当前值，当前的row，当前的索引
                        switch (value) {//0:主叫  1：被叫  2：短信发送 3：短信接收
                            case 0:return '主叫'
                            case 1:return '被叫'
                            case 2:return '短信发送'
                            case 3:return '短信接收'
                        }
                    }
                },
                {field:'STARTING_TIME',title:'起始时间',sortable : true,
                    formatter: function(value,row,index){ //当前值，当前的row，当前的索引
                        if(value){
                            var date = new Date(value);
                            return formatDate(date, 'yyyy-MM-dd hh:mm:ss');
                        }else{
                            return '-';
                        }
                    }
                },
                {field:'TALK_TIME',title:'通话时长'},
                {field:'LAC',title:'地区区域码'},
                {field:'CID',title:'基站代码'},
            ]],
            onHeaderContextMenu: function(e, field){
                e.preventDefault();
                if (!cmenu){
                    createColumnMenu();
                }
                cmenu.menu('show', {
                    left:e.pageX,
                    top:e.pageY
                });
            }
        });
	};
	/*列显示下拉框*/
    var cmenu;
    function createColumnMenu(){
        cmenu = $('<div/>').appendTo('body');
        cmenu.menu({
            onClick: function(item){
                if (item.iconCls == 'icon-ok'){
                    $('#dg').datagrid('hideColumn', item.name);
                    cmenu.menu('setIcon', {
                        target: item.target,
                        iconCls: 'icon-empty'
                    });
                } else {
                    $('#dg').datagrid('showColumn', item.name);
                    cmenu.menu('setIcon', {
                        target: item.target,
                        iconCls: 'icon-ok'
                    });
                }
            }
        });
        var fields = $('#dg').datagrid('getColumnFields');
        for(var i=0; i<fields.length; i++){
            var field = fields[i];
            var col = $('#dg').datagrid('getColumnOption', field);
            cmenu.menu('appendItem', {
                text: col.title,
                name: field,
                iconCls: 'icon-ok'
            });
        }
    };
</script>
<style>
	#hidebox {
	   top: 23px;
	   left: 2%;
	   border-radius: 5px;
	   background-color:#fff;
	   z-Index:9999;
	   padding: 10px;
	   overflow:hidden;
	   height:100%;
	   width:100%；
	}
</style>
</body>
</html>
